<!-- 空调 -->
<template>
  <div>
    <el-container>
      <el-header class="padding-left-right-40">
        <MenuTabs :PROP.sync="m_MenyTabs_Prop" @MenuSelect="MenuSelect"></MenuTabs>
      </el-header>
      <el-main class="scrollBox" v-if="m_ReLoad">
        <Equipment ref="Equipment" :PROP="m_EquipmentProp"></Equipment>
      </el-main>
    </el-container>
  </div>
</template>
<script>
import dayjs from 'dayjs';
import Api from '../../api/EquipmentManage';
import MenuTabs from '@/common/components/MenuTabs';
import Equipment from './com/Equipment';
export default {
  components: { MenuTabs, Equipment },
  data() {
    return {
      projectKey:this.$route.query.projectKey || localStorage.getItem("projectKey"),
      m_EquipmentProp: null,
      m_ReLoad: false,
      m_ComponentName: 'Information', //默认展示基本信息
      m_MenyTabs_Prop: {
        father: this,
        defaultactive: null,
        options: [],
      },
    };
  },
  filters: {
    nullVal: function (msg) {
      return msg ? msg : '-';
    },
  },
 
  mounted() {
    this.GetData();
  },
  
  methods: {
    GetData() {
      Api.parentSystemList({ projectKey: this.projectKey }).then(res => {
        res.rows.forEach(element => {
          this.m_MenyTabs_Prop.options.push({
            title: element.systemName,
            ...element,
            show: true,
            path: element.primaryKey,
          });
          
        });
        this.MenuSelect(this.m_MenyTabs_Prop.options[0].path)
        this.m_MenyTabs_Prop.defaultactive =  this.m_MenyTabs_Prop.options[0].path
        console.log('this.m_MenyTabs_Prop', this.m_MenyTabs_Prop)
      });
    },
    currentchange(res) {
      this.m_QueryParams.currentPage = res;
    },
    TableEdit(row) {},
    TableDel(row) {},
    MenuSelect(path) {
      console.log('输出的path', path)
      let obj = this.m_MenyTabs_Prop.options.find(item => {
        return item.path == path;
      });
      this.m_ReLoad = false;
      this.$nextTick(() => {
        this.m_ReLoad = true;
        this.m_EquipmentProp = obj;
        console.log(obj);
      });
    },
  },
};
</script>
<style scoped>
/* @import url(); 引入css类 */
</style>